@echo off
REM Run the disconnect idle shared connections script with admin privileges
REM Automatically checks and requests admin rights

REM Check if running as administrator
net session >nul 2>&1
if %errorLevel% == 0 (
    echo Running with administrator privileges
    powershell -ExecutionPolicy Bypass -File "%~dp0DisconnectIdleSharedConnections.ps1" -MaxConnections 15 -CheckIntervalSeconds 60
) else (
    echo Requesting administrator privileges...
    powershell -Command "Start-Process -Verb RunAs -FilePath 'powershell' -ArgumentList '-ExecutionPolicy Bypass -File \"%~dp0DisconnectIdleSharedConnections.ps1\" -MaxConnections 15 -CheckIntervalSeconds 60'"
)

pause